package com.tencreat.mall.controller.app;

import com.tencreat.common.core.HttpResult;
import com.tencreat.common.core.domain.model.ReqIdParam;
import com.tencreat.domain.mall.vo.MallCategoryVO;
import com.tencreat.service.mall.IMallAppCategoryService;
import com.tencreat.service.mall.IMallCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author tang jun liang
 * @version 1.0
 * @date 2021/9/2 10:12
 */
@Api(tags = {"3-商品分类"})
@RestController
@RequestMapping("/api/category")
public class MallCategoryController {

    @Autowired
    private IMallCategoryService mallCategoryService;

    @ApiOperation(value = "商城商品分类")
    @PostMapping("/listOne")
    public HttpResult<List<MallCategoryVO>> listOne() {
        return HttpResult.ok(mallCategoryService.apiListParent());
    }

    @ApiOperation(value = "商城商品二级分类")
    @PostMapping("/listTwo")
    public HttpResult<List<MallCategoryVO>> listTwo(@RequestBody ReqIdParam idParam) {
        return HttpResult.ok(mallCategoryService.apiListChild(idParam));
    }


    @ApiOperation(value = "店铺医疗分类")
    @PostMapping("/listMedical")
    public HttpResult<List<MallCategoryVO>> listMedical() {
        return HttpResult.ok(mallCategoryService.listMedical());
    }


    @ApiOperation(value = "店铺美食分类")
    @PostMapping("/listFoods")
    public HttpResult<List<MallCategoryVO>> listFoods() {
        return HttpResult.ok(mallCategoryService.listFoods());
    }


    @ApiOperation(value = "店铺分类查询")
    @PostMapping("/listSettleIn")
    public HttpResult<List<MallCategoryVO>> listSettleIn(Long type) {
        return HttpResult.ok(mallCategoryService.listSettleIn(type));
    }


    @ApiOperation(value = "店铺一级分类查询")
    @PostMapping("/listStoreOne")
    public HttpResult<List<MallCategoryVO>> listStoreOne() {
        return HttpResult.ok(mallCategoryService.listStoreOne());
    }


    @ApiOperation(value = "店铺二级分类查询")
    @PostMapping("/listStoreTwo")
    public HttpResult<List<MallCategoryVO>> listStoreTwo(@RequestBody ReqIdParam idParam) {
        return HttpResult.ok(mallCategoryService.listStoreTwo(idParam));
    }

}
